"""
7-2 除去自身的最大因数
"""


def resolution1():
    a = int(input())
    max_fact = 1
    for i in range(2, a):
        if a % i == 0:
            max_fact = i
    print(max_fact)
    pass


# 分解质因数
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors


def resolution2():
    a = int(input())
    factors = prime_factors(a)
    if a in factors:
        factors.remove(a)
    print(max(factors))
    pass


if __name__ == '__main__':
    # resolution1()
    resolution2()